home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / src / agg / Mapping.h < prev    next >
C/C++ Source or Header  |  1992-01-23  |  3KB  |  82 lines

  1. /* --------------------------------------------------------------------------
  2.  * Copyright 1992 by Forschungszentrum Informatik (FZI)
  3.  *
  4.  * You can use and distribute this software under the terms of the licence
  5.  * you should have received along with this program.
  6.  * If not or if you want additional information, write to
  7.  * Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
  8.  * D-7500 Karlsruhe 1, Germany.
  9.  * --------------------------------------------------------------------------
  10.  */
  11. #ifndef MAPPINGH
  12. #define MAPPINGH 1
  13.  
  14. #include "knl_use.h"
  15.  
  16. // MAX_PAGE_SIZE regelt die Groesse einer Seite, als tatsaechliche 
  17. // Seitengroesse wird die groesstmoegliche Zahl < MAX_PAGE_SIZE benutzt.
  18. // Auf eine Seite muessen mindestens 3 Eintraege passen !!!
  19. // Daher MAX_PAGE_SIZE >= 216 (falls Listenversion)
  20. const sos_Int MAX_PAGE_SIZE = 1024; 
  21.  
  22. // Der Datentyp object_save_t wird als sos_typed_id abgespeichert
  23. union object_save_t {sos_Typed_id dummy; char c[SOS_TYPED_ID_SIZE];};
  24.  
  25. typedef struct ht_entry_t 
  26.    {  sos_Offset page_list_offset; 
  27.       sos_Char local_depth;         
  28.    };
  29.  
  30. typedef struct entry_t
  31.    {  sos_Int hash_value;
  32.       object_save_t key;
  33.       object_save_t info;
  34.    };
  35.  
  36. typedef struct list_t
  37.    {  object_save_t pred;
  38.       object_save_t succ;
  39.    };
  40.  
  41. typedef struct page_header_t
  42.    {  sos_Char pages;
  43.       sos_Char entries_on_last_page;
  44.       sos_Offset next_page;
  45.    };
  46.  
  47. const sos_Int PAGE_HEADER_SIZE = SOS_OFFSET_SIZE + 2*CHAR_SIZE;
  48. const sos_Int ENTRY_SIZE       = INT_SIZE + 2*SOS_TYPED_ID_SIZE;
  49. const sos_Int HT_ENTRY_SIZE    = SOS_OFFSET_SIZE + CHAR_SIZE;
  50. const sos_Int LIST_SIZE        = 2*SOS_TYPED_ID_SIZE;
  51.  
  52. const sos_Int max_page_entries_with_list =
  53.    (MAX_PAGE_SIZE - PAGE_HEADER_SIZE)/(ENTRY_SIZE+LIST_SIZE);
  54.  
  55. const sos_Int max_page_entries_without_list=
  56.    (MAX_PAGE_SIZE - PAGE_HEADER_SIZE)/ENTRY_SIZE;
  57.  
  58. const sos_Int add_list_pos = PAGE_HEADER_SIZE+
  59.                  ENTRY_SIZE*max_page_entries_with_list;
  60.  
  61. typedef struct page_t
  62.    {  page_header_t  page_header;
  63.       entry_t        entry[max_page_entries_without_list];
  64.       list_t         list[max_page_entries_without_list];
  65.    };
  66.  
  67. const page_size_with_list = PAGE_HEADER_SIZE+ 
  68.                 max_page_entries_with_list* (ENTRY_SIZE+LIST_SIZE);
  69.  
  70. const page_size_without_list = PAGE_HEADER_SIZE+ 
  71.                 max_page_entries_without_list * ENTRY_SIZE;
  72.  
  73.    // maximale globale Tiefe, eine rein akademische Groesse, 
  74.    // da vorher eh die Platte platzt
  75. const MAX_GLOBAL_DEPTH = 20;
  76.  
  77.    // Groesse des Feldes, in dem die Anzahlen der Seitenlisten 
  78.    // mit einer bestimmten lokalen Tiefe gespeichert sind:
  79. const NO_OF_PAGES_ARRAY_SIZE = INT_SIZE*MAX_GLOBAL_DEPTH;
  80.  
  81. #endif
  82.